﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Bussiness.Manager;
public partial class Control_home : System.Web.UI.UserControl
{

    private Guid newLed = Guid.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            LoadNewDetail();
    }

    private void LoadNewDetail()
    {
        DataTable tab = CmsNewsManager.CreateInstant().getTopNews(1);
        if (tab != null && tab.Rows.Count > 0)
        {
            repNews.DataSource = tab;
            repNews.DataBind();
        }
    }


    protected void ItemBound(object sender, RepeaterItemEventArgs args)
    {
        RepeaterItem item = args.Item;
        if (item.ItemType == ListItemType.Item) {
            HiddenField hide = (HiddenField)item.FindControl("hiddenfield");
            newLed = WB.Library.FGuid.ToGuid(hide.Value.ToString());
        }else
        if (item.ItemType== ListItemType.Footer)
        {
           
            Repeater rep = (Repeater)item.FindControl("repNewChildren");
     
            DataTable tab = CmsNewsManager.CreateInstant().getTopNews(5, newLed);
            if (tab != null && tab.Rows.Count > 0)
            {
                rep.DataSource = tab;
                rep.DataBind();
            }
        }
    }
}


